<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="HandheldFriendly" content="true" />
    <meta name="MobileOptimized" content="320" />
    <link rel="stylesheet" type="text/css" href="css/reset.css"/>
    <link rel="stylesheet" type="text/css" href="css/animate.css"/>
    <link rel="stylesheet" type="text/css" href="css/mui.min.css"/>
    <link rel="stylesheet" type="text/css" href="css/go-wakuang.css"/>
    <link rel="stylesheet" href="./css/jiazai.css">
    <title>一键挖矿</title>
</head>

<body>
    <div id='app'>

         <!-- 加载中动画 -->
        <div id='jiazai-ani' v-if='jiazai'>
            <div class="arc"></div>
            <h1><span>LOADING</span></h1>
        </div>
        <!-- 加载中动画 -->
        
        <div id="com-tit" class='dis-spa'>
        	<div class='cont'>
        		<p class='menu dis-start' @tap="_close();">
	        		<img src="img/back-white.svg" style="width: 22px;height: 22px;" />
        		</p>
        	</div>
        	<div>一键挖矿</div>
        	<div class='cont'><img src="img/why.svg" style="width: 27px;height: auto;opacity: 0;"/></div>
        </div>
        
        <div id="content-wrap">
			<div class="trans-img">
				<img src="img/yijian-bg.png" style="width: 100%;height: auto;"/>
				<div class="dis-cen ani-img">
					<img src="img/yijian-peo.png"/>	
					<img  :style="{'opacity': jiazai?0:1}" class='coins-ani' src="img/yijian-coins.png"/>
				</div>
			</div>
			<div style="padding: 0 20px;">
				<div class="input-money">
					<p class='dis-start'>
						<img src="img/bt.jpg" style="width: 40px;height: auto;" style="width: 40px;height: 40px;border-radius: 50%;"/>
						<span class='coins-name'>BT</span>
					</p>
					<p class='dis-spa input' v-if='!success'>
						<!--!success-->
						<input type="text" placeholder="请输入您需要挖矿的金额" v-model='number'/>
						<span>USDT</span>
					</p>
					<div v-if='success'>
						<p style="text-align: center;color: #B5D1E2;">AI机器人  BT/日收益(1%-20%)</p>
						<h3 style="text-align: center;color: #B5D1E2;">{{totalMining}}</h3>
					</div>
					<p class='max-wakuang' v-if='!success'>最大挖矿量：<span v-text='maxBet'>0.00</span><span>USDT</span></p>
				</div>
			</div>
			<div class="yijian-btn" style="margin-bottom: 50px;">
				<p @tap='goWa' v-if='!success'>一键挖矿</p>
				<p @tap='goWa' v-if='success' style="background: white;border: 1px solid #eee;color: #999;">挖矿中</p>
				<p @tap='closeWa' v-if='success'>取消挖矿</p>
			</div>
        </div>
    </div>
    <script src="js/comm.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/vue.min.js"></script>
    <script src="js/mui.min.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript" charset="utf-8">
        var app = new Vue({
            el: '#app',
            data: {
                //加载动画
                jiazai: false,
                //挖矿的number
                number:'',
                //最大挖矿量
                maxBet:'',
                //true:正在挖矿中  false:没挖矿
                success:false,
                //首页下面的那啥数据
                totalMining:0
            },
            created: function() {
				//得到最大挖矿量和挖矿状态
				this.getMax();
				//得到首页的下面的那啥数据
				this.getDownData();
            },
            methods: {
				//一键挖矿
				goWa:function(){
					var This=this;
					if(!_ifNum(this.number,'float')){
						_toast('您输入的挖矿金额有误');
						return;
					}
					if(parseFloat(this.number)>parseFloat(this.maxBet)){
						_toast('挖矿金额已超出最大挖矿量');
						return;
					}
            		This.jiazai=true;
            		HTTP.post(WAKUANG,{
            			number:this.number
            		},function(data){
            			This.jiazai=false;
            			_toast(data.msg);
            			if(String(data.status)=='1'){
            				setTimeout(function(){
            					_close();
            				},1200);
            			}
					});
				},
				//得到最大挖矿量
				getMax:function(){
					var This=this;
            		This.jiazai=true;
            		HTTP.post(MAXWAKUANG,{},function(data){
            			This.jiazai=false;
            			if(String(data.status)=='1'){
            				This.maxBet=data.config.MaxBet;
            				This.success=String(data.success)=='0'?false:true;
            			}else{
            				_toast(data.msg);
            				setTimeout(function(){
            					_close();
            				},1500);
            			}
					});
				},
				//得到首页下面的那啥数据
            	getDownData:function(){
            		var This=this;
            		HTTP.post(INDEXDATA,{},function(data){
            			This.totalMining=parseFloat(data.totalMining).toFixed(6);
					});
            	},
				//取消挖矿
				closeWa:function(){
					var This=this;
            		This.jiazai=true;
            		HTTP.post(CLOSEWAKUAGN,{},function(data){
            			This.jiazai=false;
            			_toast(data.msg);
            			if(String(data.status)=='1'){
            				setTimeout(function(){
            					_close();
            				},1200);
            			}
					});
				}
            }
        });
       
    </script>
</body>

</html>